# Maintainer: Ariadne Conill <ariadne@dereferenced.org>
pkgname=ko
pkgver=0.11.2
pkgrel=0
pkgdesc="build containers from go projects"
url="https://github.com/google/ko"
arch="all"
license="Apache-2.0"
makedepends="go"
subpackages="
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/google/ko/archive/v$pkgver/ko-$pkgver.tar.gz"

build() {
	mkdir build
	go build -o build/ "$builddir"/...

	for i in bash fish zsh; do
		"$builddir"/build/ko completion $i > "$builddir"/ko.$i
	done
}

check() {
	go test "$builddir"/...
}

package() {
	install -Dm755 "$builddir"/build/ko "$pkgdir"/usr/bin/ko

	install -Dm644 "$builddir"/ko.bash "$pkgdir"/usr/share/bash-completion/completions/ko
	install -Dm644 "$builddir"/ko.fish "$pkgdir"/usr/share/fish/completions/ko.fish
	install -Dm644 "$builddir"/ko.zsh "$pkgdir"/usr/share/zsh/site-functions/_ko
}

sha512sums="
544b19bf4e4fd02cf18a5162bfc447126b55e879e1d0999aa6d0f785696bcde755ef5a7f56cccc5eeba541d7940c4bd2d636b95f0a94d6896bf5be07527cc42e  ko-0.11.2.tar.gz
"
